package com.fit.toysShop.pages;

import java.util.LinkedList;
import com.fit.toysShop.beans.ProductBean;
import com.fit.toysShop.interfaces.Product;
import com.fit.toysShop.interfaces.Purchase;
import com.fit.toysShop.interfaces.PurchaseItem;
import com.fit.toysShop.service.*;

import org.apache.tapestry5.annotations.*;
import org.apache.tapestry5.ioc.annotations.*;

public class EntryProduct {

	@Property
	@Persist
	private Product product;

	@Inject
	private Products products;

	@SetupRender
	public void createObject() {
		product = new ProductBean();
		product.setPurchaseItem(new LinkedList<PurchaseItem>());
	}

	public void onSuccess() {
		products.save(product);
	}
}